﻿using Model;
using DAL;
using System.Collections.Generic;
using System;

namespace BLL
{
    public class LogService
    {
        private readonly LogRepository _logRepository = new LogRepository();

        public void AddLog(string actionType, string entityName, int entityID, string description)
        {
            var log = new Log
            {
                ActionType = actionType,
                EntityName = entityName,
                EntityID = entityID,
                Timestamp = DateTime.Now,
                Description = description
            };
            _logRepository.AddLog(log);
        }

        public List<Log> GetAllLogs(string actionType)
        {
            return _logRepository.GetAllLogs(actionType);
        }

        
        //这个实现原理同
        public void DeleteLog(int logID)
        {
            _logRepository.DeleteLog(logID);
        }

        public void ClearLogs()
        {
            _logRepository.ClearLogs();
        }
    }
}
